package com.example.ticketorder.repository.dao;

import com.example.ticketorder.entity.Sales;
import com.example.ticketorder.repository.SalesRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import java.sql.Date;
import java.sql.Time;
import java.util.List;

@Repository
public class SalesDao {
    @Autowired
    @Qualifier("salesRepository")
    private SalesRepository salesRepository;
    public Sales add(Sales sale) {
        salesRepository.save(sale);
        return sale;
    }
    public Iterable<Sales> findSales(String order, String phone){
        return salesRepository.findSales(order,phone);
    }
    public void insertSale(String order_Number, String phone, String car, String destination, Date date, Time timea,Time timeb,double money){
        salesRepository.insertSale(order_Number,phone,car,destination,date,timea,timeb,money);
    }
    public void deleteSale(String order_Number, String phone){
        salesRepository.deleteSale(order_Number,phone);
    }
}
